<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title> js 的第一个测试 </title>
    <!-- css也可以嵌入html中 -->
    <style>

    </style>

    <script>
        var count = 0
        function clickFunc() {
            // 下面的写法叫做 字符串模板
            document.getElementById("h1").innerText = `${++count}`

            document.getElementById("img").style.visibility = count % 2 == 0 ? "visible" : "hidden"
        }
    </script>
</head>

<body>
    <div style="text-align:center">
        <h1 id="h1" style="font-size: 40px;">数值：0</h1>
        <button style="font-size: 30px;
         background-color: burlywood;" onclick="clickFunc()">点击</button>
    </div>

    <div id="img" style="visibility:visible;">
        <img src="demo.png" width="200px">
    </div>
</body>

</html>